<!DOCTYPE html [
    <!ENTITY nbsp "&#160;"> 
]>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
#accountInfo .box-header {
	padding: 19px;
}

#statistics .box-title {
	font-size: 16px;
}

#vol p:nth-child(2) {
	font-size: 15px;
}

select {
	color: black;
}

.ui-autocomplete-input {
	width: 100%;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button"
				styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button"
				styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="headForm">
				<p:growl id="msgs" showDetail="true" />
				<div class="box-header" id="queryDiv">
					<p:outputLabel for="popup7" value="故障时间：" style="margin-left:10px;" />
					<p:calendar id="popup7" navigator="true"
						value="#{requestTaskConfigController.faultTimeStart}"
						pattern="yyyy-MM-dd" maxdate="Date()" size="14">
					</p:calendar>
					<p:outputLabel for="popup8" value="至 "
						style="margin-right:5px;margin-left:5px;" />
					<p:calendar id="popup8" navigator="true"
						value="#{requestTaskConfigController.faultTimeEnd}"
						pattern="yyyy-MM-dd" maxdate="Date()" size="14"
						style="margin-right:10px">
					</p:calendar>
					<p:outputLabel for="taskStatus" value="任务状态：" />
					<h:selectOneMenu value="#{requestTaskConfigController.showType}"
						id="taskStatus" style="margin-right:20px;width:120px;height:30px">
						<f:selectItem itemLabel="待执行" itemValue="0" />
						<f:selectItem itemLabel="已执行待返回" itemValue="1" />
						<f:selectItem itemLabel="手动停止" itemValue="2" />
						<f:selectItem itemLabel="任务过期" itemValue="3" />
						<f:selectItem itemLabel="执行成功" itemValue="4" />
						<f:selectItem itemLabel="全部任务" itemValue="5" />
					</h:selectOneMenu>
					<p:commandButton value="查询" icon="ui-icon-search"
						actionListener="#{requestTaskConfigController.showTasks}"
						update="form:dataTb" oncomplete="getTableScrollHeight();" />
					<p:commandButton icon="ui-icon-refresh" value="重置"
						actionListener="#{requestTaskConfigController.initData}"
						style="margin-left:5px;" oncomplete="getTableScrollHeight();"
						update="form:dataTb taskStatus popup7 popup8" />
				</div>
			</h:form>
		</div>
		<div id="infoDiv" class="box box-solid with-border">
			<h:form id="form">
				<p:dataTable id="dataTb" var="c" emptyMessage="无记录" editable="true"
					editMode="cell" value="#{requestTaskConfigController.records}"
					rowKey="#{c.record.id}" paginator="true" rowIndexVar="ite"
					paginatorPosition="bottom" rows="20"
					rowsPerPageTemplate="20,50,100" scrollable="true"
					paginatorTemplate="{Customer} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					style="margin-bottom:20px;text-align: center">
					<f:facet name="{Customer}">
						<p:outputLabel
							value="总计：#{requestTaskConfigController.records.size()}条纪录"
							style="margin-right:20px" />
					</f:facet>
					<p:column headerText="序号" style="width:50px;">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="变电站名称" width="150">
						<h:outputText value="#{c.stationName}" />
					</p:column>
					<p:column headerText="故障时间" width="180">
						<h:outputText value="#{c.faultTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="故障设备" width="150">
						<h:outputText value="#{c.equipment}" />
					</p:column>
					<p:column headerText="任务描述" width="150">
						<h:outputText value="#{c.record.type==0?'获取动作元件':'获取录波文件'}" />
					</p:column>
					<p:column headerText="任务开始时间" width="180">
						<h:outputText value="#{c.record.startTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="任务完成时间" width="180">
						<h:outputText value="#{c.record.endTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="任务状态" width="180">
						<h:outputText
							value="#{requestTaskConfigController.getFaultStatus(c.record.taskStatus)}" />
					</p:column>
					<p:column width="150" headerText="操作">
						<p:commandButton icon="ui-icon-play" title="开始"
							disabled="#{!requestTaskConfigController.isAbleStart(c.record.taskStatus)}"
							rendered="#{s:hasPermission(session,'bhyx_gzsjhqrw_ks')}"
							actionListener="#{requestTaskConfigController.startTask(c)}"
							oncomplete="getTableScrollHeight();"
							update=":headForm:msgs dataTb"></p:commandButton> &nbsp;&nbsp;&nbsp;
						<p:commandButton icon="ui-icon-stop" title="停止"
							disabled="#{!requestTaskConfigController.isAbleEnd(c.record.taskStatus)}"
							rendered="#{s:hasPermission(session,'bhyx_gzsjhqrw_tz')}"
							actionListener="#{requestTaskConfigController.stopTask(c)}"
							oncomplete="getTableScrollHeight();"
							update="headForm:msgs dataTb"></p:commandButton> &nbsp;&nbsp;&nbsp;
					</p:column>
				</p:dataTable>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/js/tables/singleScrollTable.js" />
		<script src="/resources/plugins/datatables/jquery.dataTables.js"></script>
		<script
			src="/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="/resources/js/tables/mytable.js"></script>
		<script src="/resources/js/mymodal.js"></script>
	</ui:define>
</ui:composition>
